<?php

namespace Admin\Controller;

use Think\Controller;

class VisitorController extends BaseController {

    public function index() {
        $this->title = "游客管理";
        $m = M("visitor");
        $data = $m->select();
        $this->assign("data", $data);
        $this->display();
    }
    
    public function setActive(){
        $id=I("get.id");
      
        $m = M("visitor");
        $where="id=".$id;
        $data = $m->where($where)->find();
        //print_r($data);
        $this->assign("data",$data);
        $this->display();
        
    }
    public function saveActive(){
        $data = I("post.");
        
        $sql="update visitor set respond='".$data['reply']."',reply=1  where id=".$data['id'];
        $m =M("visitor");
        $tag=$m->execute($sql);
           if($tag!==false){
              $this->success("ok");
           }else{
               $this->error("error");
           } 
    }
    
    public function info(){
        $id = I("get.id");
        $m =M("visitor");
        $where = "id =".$id;
       
        $data=$m->where($where)->find();
      
        $this->assign("data",$data);
        $this->display();
        
    }
    
    

}
?>

